<template>
  <div class="content">
    <UserIndexTop :showfun="hidden"></UserIndexTop>
    <div class="backButton">
      <el-button type="text" @click="$router.go(-1)">返 回</el-button>
    </div>
    <div class="page_content">
      <div class="title">公众平台账号授权</div>
      <div class="box_content">
        <img :src="qrcodeUrl" alt />
        <div class="text">使用公众平台绑定的管理员个人微信号扫描</div>
      </div>
    </div>
  </div>
</template>
<script>
import UserIndexTop from "@/components/IndexCon/userindextop";
import { GetEmpower } from "@/api/wx_config";
export default {
  components: {
    UserIndexTop
  },
  data() {
    return {
      qrcodeUrl: "", // 二维码url
      appid: ""
    };
  },
  mounted() {
    this.appid = this.$route.query.appid;
    console.log(this.appid);
    this.getData();
  },
  methods: {
    // 保存二维码链接
    getData() {
      GetEmpower("296").then(res => {
        if (res.code === 200) {
          console.log(res.data);
          this.$message({
            type: "success",
            message: res.msg
          });
          this.qrcodeUrl = res.data.qrcode_url;
          // window.location.href = res.data
          // GetEmpower(this.appid).then(res=>{
          //   if(res.code == 200){
          //     this.showQrcode = true;
          //     this.qrcodeUrl = res.data.qrcode_url;
          //   }
          // })
        } else {
          this.$message({
            type: "error",
            message: res.msg
          });
        }
      });
    }
  }
};
</script>
<style lang="scss" scoped>
.content {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  .page_content {
    width: 400px;
    height: auto;
    margin: 100px auto 0;
    padding: 0 5px;
    box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.07);
    .title {
      color: #666;
      border-bottom: 1px solid #999;
      height: 60px;
      line-height: 60px;
      text-align: center;
    }
    .box_content {
      margin-top: 60px;
      padding-bottom: 60px;
      img {
        width: 340px;
        height: 340px;
        margin-left: 30px;
      }
      .text {
        margin-top: 20 px;
        text-align: center;
      }
    }
  }
  .backButton {
    position: absolute;
    top: 12px;
    right: 20px;
    height: 40px;
    border-radius: 20px;
    border: 1px solid #5b93ff;
    line-height: 40px;
    color: #5b93ff;
    text-align: center;
    width: 80px;
    z-index: 99999;
  }
  .code_box {
    width: 260px;
    height: 260px;
    margin: 0 auto;
    border: 1px solid #333;
    img {
      width: 260px;
      height: 260px;
    }
  }
  .code_button {
    margin-top: 5px;
    line-height: 20px;
    text-align: center;
  }
}
</style>
